package com.atguigu.lease.common.context;

/*
* 把封装了登录用户信息的loginUser对象保存到ThrealdLocal线程中
 */

public class LoginUserContext {

    private static ThreadLocal<LoginUser> threadLocal = new ThreadLocal<>();

    //保存数据
    public static void setUser(LoginUser loginUser){
        threadLocal.set(loginUser);
    }
    //获取数据
    public static LoginUser getUser(){
        return threadLocal.get();

    }
    //删除数据
    public static void removeUser(){
        threadLocal.remove();
    }

}
